/**
 * 
 */
package com.googlecode.rotools.rodb;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * 
 */
class ItemImpl extends Item{
	ItemImpl(ResultSet resultSet) throws SQLException{
		setId(resultSet.getString("ITEM_ID"));
		setName(resultSet.getString("ITEM_NAME"));
		setUnknownName(resultSet.getString("ITEM_UNKNOWN_NAME"));
		setDescription(resultSet.getString("ITEM_DESCRIPTION"));
		setUnknownDescription(resultSet.getString("ITEM_UNKNOWN_DESCRIPTION"));
		setSlot(getInteger(resultSet, "ITEM_SLOT"));
		setWeaponLevel(getInteger(resultSet, "WEAPON_LEVEL"));
		setWeaponAtk(getInteger(resultSet, "WEAPON_ATK"));
		setGuardDef(getInteger(resultSet, "GUARD_DEF"));
		setSlotCount(getInteger(resultSet, "SLOT_COUNT"));
		setCardPrefix(resultSet.getString("CARD_PREFIX"));
		
	}
	private Integer getInteger(ResultSet resultSet, String name) throws SQLException{
		Integer integer = null;
		int n = resultSet.getInt(name);
		if(!resultSet.wasNull()){
			integer = new Integer(n);
		}
		return integer;
	}
}

